package com.drools.rule.controller;

import com.drools.rule.req.LoginActionReq;
import com.drools.rule.req.RuleReq;
import com.drools.rule.service.RuleService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@RestController
@RequestMapping("/rule")
public class CreateDrlController {

    @Resource
    private RuleService ruleService;

    @RequestMapping(value = "/create", method = RequestMethod.POST)
    public Boolean create(@RequestBody RuleReq ruleReq){
        return ruleService.create(ruleReq);
    }

    @RequestMapping(value = "/login/action/execute", method = RequestMethod.POST)
    public Boolean execute(@RequestBody LoginActionReq actionReq){
        return ruleService.execute(actionReq);
    }

}
